from django.db import models


# Create your models here.
from django.utils import timezone


class Person(models.Model):
    WORK_LEAVE = ((True, "在职"), (False, "离职"))

    name = models.CharField(max_length=5, verbose_name="姓名")
    entry_time = models.DateField(verbose_name="入职时间", default=timezone.now)
    leave_time = models.DateField(verbose_name="离职时间", blank=True, null=True)
    work_or_leave = models.BooleanField(verbose_name='是否在职', default=True, choices=WORK_LEAVE)

    def __str__(self):
        return str(self.name)

    class Meta:
        ordering = ('pk',)
        verbose_name = '姓名'
        verbose_name_plural = verbose_name
